//  @ Project : GagalPanen
//  @ File Name : direction.cpp
//  @ Date : 3/9/2011
//  @ Author : dolphinigle
//
//

#if !defined(_DIRECTION_CPP)
#define _DIRECTION_CPP

#include "direction.hpp"

int DirectionNamespace::getDeltaX(Direction dir) {
    switch (dir) {
        case kLeft :
            return -1;
        case kRight :
            return 1;
        default:
            return 0;
    }
}

int DirectionNamespace::getDeltaY(Direction dir) {
    switch (dir) {
        case kUp :
            return -1;
        case kDown :
            return 1;
        default:
            return 0;
    }
}

Direction DirectionNamespace::getTurnLeft(Direction dir) {
  return Direction(((int)dir + 1) % 4);
}
Direction DirectionNamespace::getTurnRight(Direction dir) {
  return Direction(((int)dir + 3) % 4);
}
Direction DirectionNamespace::getTurnBack(Direction dir) {
  return Direction(((int)dir + 2) % 4);
}

int DirectionNamespace::getDirectionCount() {
  return 4;
}

std::string DirectionNamespace::getDirectionSingleRep(Direction dir) {
  switch(dir) {
    case kUp :
      return "^";
    case kDown :
      return "v";
    case kLeft :
      return "<";
    case kRight :
      return ">";
  }
}

#endif